from apps.interface.tabbarItem.baseViews import *
from apps.interface.client.dao import ClientDao
from django.db.models import Q
from project.settings import build


class TabbarItemViewSet(BaseTabbarItemViewSet):
    authentication_classes = []
    permission_classes = []
    def get_queryset(self):
        params = getRequestParams(self.request)
        _list = TabbarItemDao().findAll().order_by('-isShow', 'sort')
        client = ClientDao().findAll().filter(clientname=params.get('clientname')).first()
        if client:
            if client.checking and params.get('build') == str(build):
                _list = _list.filter(Q(id=1) | Q(id=9))
            else:
                _list = _list.exclude(id=9)
        return _list
